﻿
using UnityHFSM;

public class FailureState : State<State>
{
    public override void OnEnter()
    {
        AudioManager.Instance.PlaySound(SoundType.Die);
        GameSystem.Instance.CurrentPlayer.Die(AfterDie);
    }

    private void AfterDie() 
    {
        GameSystem.Instance.ResetCount--;

        if (GameSystem.Instance.ResetCount < 0)
        {
            GameSystem.Instance.ChangeGameState(State.End);
        }
        else
        {
            GameSystem.Instance.ChangeGameState(State.Load);
        }
    }
}

